<template>
	<view class="content">
		<view class="close-title" @click="guanBiding">
			卖家/买家关闭了订单
		</view>
		<view class="close-content" @click="details(OrderBuyDetail.waresId)">
			<view class="close-content-img">
				<image :src="OrderBuyDetail.waresImgs" mode=""></image>
			</view>
			<view class="close-content-name">
				<view class="close-content-name1">{{OrderBuyDetail.waresContent}}</view>
					<view class="close-content-name2">电子数码|游戏机</view>
					<view class="close-content-name3">￥{{OrderBuyDetail.actualPrice}}</view>
			</view>
		</view>
		<!-- 收货地址 -->
		<view class="close-dizhi">
			<view class="close-dizhi1">
				收货地址： {{OrderBuyDetail.addressee}} {{OrderBuyDetail.telPhone}}
			</view>
			<view class="close-dizhi2">
				{{OrderBuyDetail.address}}
			</view>
		</view>
		<!-- 操作日志 -->
		<view class="close-log">
			<view class="log-title">
				<view class="log-title1">操作日志</view>
				<view class="log-title2">联系卖家</view>
			</view>
			<view class="log-content">
				<view class="log-content1">订单编号： YW20210101120817569808</view>
				<view class="log-content2">对方昵称： {{OrderBuyDetail.sellNickName}}</view>
				<view class="log-content3">拍下时间： {{OrderBuyDetail.time}}</view>
				<view class="log-content4">付款时间： {{OrderBuyDetail.payTime}}</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="bottom-btn" @click="goShan">
			<view class="btn1">删除订单</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				OrderBuyDetail:[],
				orderId:'',
				delpath:'',
				identity:'',
				evaluateId:'222',//评价ID
				orderId:'111',// 订单ID
				commid:'4b7ed5435b8d4de2b656e1be47487e26',//商品id
				guanbi:'',//关闭订单
				delshan:'',// 删除订单卖家
				deleshan2:'',//删除订单买家
			};
		},
	
		onLoad(parameter) {
			this.identity=parameter.pages.split('orderId')[0]
			this.orderId=parameter.pages.split('orderId')[1]
			if (this.identity== 1) {
				this.delpath=':8090/web/idleOrders/idleOrderBuyDelete'
				
			} else {
				this.delpath=':8090/web/idleOrders/idleOrderSellDelete'
			}
			this.idleOrderBuyDetail()
			this.lieBiao1()
			this.lieBiao2()
			this.guanBiding()
		},
		methods: {
			//关闭订单
			guanBiding() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderClose',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:'222'
				     },
				     afterAjax: (res) => {
						 		console.log(res,'关闭订单接口')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取关闭订单接口失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到了关闭订单接口')
						 		}
						 	
				     }
				    })
			},
			//删除订单买家
			lieBiao1() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderBuyDelete',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:'commid'
				     },
				     afterAjax: (res) => {
						 		console.log(res,'关闭订单接口')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取买家关闭订单接口失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到了买家关闭订单接口')
						 		}
						 	
				     }
				    })
			},
			//删除订单卖家
			lieBiao2() {
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderSellEvaluateDelete',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					  orderId:that.orderId,
					  evaluateId:that.evaluateId
				     },
				     afterAjax: (res) => {
						 		console.log(res,'关闭订单接口')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取关闭订单接口失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到了关闭订单接口')
						 			that.guanbi = res
						 		}
						 	
				     }
				    })
			},
			goShan() {
				// uni.showToast({
				// 	title: '测试数据，不可删除',
				// 	icon: 'none'
				// })
				var that = this
				that.$http.req.ajax({
				     path: ':8090/web/idleOrders/idleOrderSellDelete',
					 header: {
					       'token': uni.getStorageSync('token')
					      },
				     data: {
					 orderId:that.orderId
				     },
				     afterAjax: (res) => {
						 		console.log(res,'删除订单接口')
						 		if (res.code !== 200) {
						 			uni.showToast({
						 				title: '获取删除订单接口失败',
						 				icon: 'none'
						 			})
						 		}
						 		if (res.code == 200) {
						 			console.log('拿到了删除订单接口')
						 			that.delshan = res
						 		}
						 	
				     }
				    })
			},
			// 跳转到详情页面
			details(){
				uni.navigateTo({
					url:'../../commodity-details/commodity-details?waresId='+ 1
				})
				// evaluateId:'222',//评价ID
				// // orderId:'',// 订单ID
				// commid:'4b7ed5435b8d4de2b656e1be47487e26',//商品id
				// guanbi:'',//关闭订单
				// delshan:'',// 删除订单卖家
				// deleshan2:'',//删除订单买家
			},
			del(orderIds){
				var that = this
				that.$http.req.ajax({
					path: this.delpath,
					header: {
						'token': uni.getStorageSync('token')
					},
					data: {
						orderId: orderIds,
					},
					afterAjax: (res) => {
						console.log(res, '删除')
					}
				})
			},
			}
		}
	
</script>

<style lang="scss">
	page{
		background: #F5F5F5;
	}
.content {
	width: 100%;
	background-color: #f5f5f5;
	height: 100%;
	.close-title {
		font-size: 28rpx;
		font-weight: 600;
		padding-top: 36rpx;
		padding-bottom: 54rpx;
		padding-left: 25rpx;
		background: linear-gradient(#fcc122, #ffe246);
	}
	.close-content {
		border-radius: 14rpx;
		background-color: #FFFfff;
		margin: 25rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		.close-content-img {
			width: 206rpx;
			height: 206rpx;
			margin: 25rpx;
			image {
				max-width: 100%;
				max-height: 100%;
			}
		}
		.close-content-name {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			margin: 25rpx;
			
			.close-content-name1 {
				
				font-size: 25rpx;
				font-weight: 600;
			}
			.close-content-name2 {
				font-size: 21rpx;
				margin-top: 21rpx;
				color: #c2c2c2;
			}
			.close-content-name3 {
				font-size: 25rpx;
				color: #eb3e3e;
				font-weight: 600;
			}
		}
	}
	// 地址
	.close-dizhi {
		margin: 25rpx;
		border-radius: 18rpx;
		background-color: #FFFFFF;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.close-dizhi1 {
			font-size: 28rpx;
			font-weight: 600;
			margin: 25rpx;
		}
		.close-dizhi2 {
			font-size: 21rpx;
			margin: 21rpx 25rpx 25rpx 25rpx;
		}	
	}
	// 日志
	.close-log {
		margin: 25rpx;
		background-color: #ffffff;
		border-radius: 18rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.log-title {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			margin: 25rpx;
			.log-title1 {
				font-size: 28rpx;
				font-weight: 600;
			}
			.log-title2 {
				border-radius: 25rpx;
				font-size: 21rpx;
				border: 1rpx solid #cccccc;
				padding: 10rpx 18rpx;
			}
		}
		.log-content {
			margin: 25rpx;
			color: #b0b0b0;
			font-size: 21rpx;
			.log-content1, .log-content2, .log-content3, .log-content4 {
				margin: 5rpx 0;
			}
			
		}
	}
	// 底部安安
	.bottom-btn {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 105rpx;
		line-height: 85rpx;
		background-color: #FFFFFF;
		padding-top: 18rpx;
		.btn1 {
			border-radius: 69rpx;
			margin: 0rpx 25rpx;
			border:  1rpx solid #d94d46;
			color: #d49d46;
			text-align: center;
		}
	}
}
</style>
